package br.ufrj.dcc.comp2.musica.vista;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import br.ufrj.dcc.comp2.musica.controle.ControleCardLayout;

/*
 * cada painel tah com a apresentação feia mas amanha
 * vou perguntar pro flavio como melhoro isso
 */
public class PainelEmitirRelatorio extends JPanel {

	private JButton botaoHistoricoProfissional = new JButton("botao1");
	private JButton botaoEmitirFolhaPagamento = new JButton("botao2");
	private JLabel labelHistoricoProfissional = new JLabel(
			"Historico Profissional.");
	private JLabel labelEmitirFolhaPagamento = new JLabel(
			"Emitir Folha de Pagamento.");
	private GridBagLayout gridBagLayout = new GridBagLayout();
	private GridBagConstraints gridBagConstraints = new GridBagConstraints();
	private Insets espacamentoEntreComponentes = new Insets(10, 10, 10, 0);
	
	private ControleCardLayout controleCardLayout;

	public ControleCardLayout getControleCardLayout() {
		return controleCardLayout;
	}

	public PainelEmitirRelatorio(ControleCardLayout controleCardLayout) {

		this.controleCardLayout = controleCardLayout;
		this.setLayout(gridBagLayout);

		// teste
		botaoEmitirFolhaPagamento.setPreferredSize(new Dimension(70, 60));
		botaoHistoricoProfissional.setPreferredSize(new Dimension(70, 60));

		// adicionar botoes coluna '1'
		adicionar(botaoHistoricoProfissional, 1, 0);
		adicionar(botaoEmitirFolhaPagamento, 1, 1);

		// adicionar labels coluna '2'
		adicionar(labelHistoricoProfissional, 2, 0);
		adicionar(labelEmitirFolhaPagamento, 2, 1);

		this.setBorder(BorderFactory.createTitledBorder("Emitir Relatorios"));
	}

	public void adicionar(Component c, int x, int y) {
		gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
		gridBagConstraints.gridx = x;
		gridBagConstraints.gridy = y;
		gridBagConstraints.ipady = 3;
		gridBagConstraints.insets = espacamentoEntreComponentes;

		add(c, gridBagConstraints);
	}

}
